﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="/static/css/common/reset.css" />
    <link rel="stylesheet" href="/static/css/associate.css" />
    <link rel="stylesheet" href="/static/css/ng-pagination.min.css" />
    <title>宾果高校</title>
</head>
<body>
    <div class="associate">
        <div id="divHeader"></div>
        <section class="assoc-content container clearfix">
            <div class="assoc-c-left fl">
                <div class="assoc-cl-top">
                    <img src="/static/images/community1.png" />
                </div>
                <div id="divNavigation"></div>
            </div>
            <div class="assoc-c-right fr">
                <div class="assoc-cr-underActivity" ng-app="myApp">
                    <ul class="assoc-cru-title clearfix" id="assoc-cru-title">
                        <li class="active">进行中</li>
                        <li>已结束</li>
                    </ul>
                    <div class="assoc-cru-content mt10">
                        <div class="assoc-cru-list mt5 borderbtm clearfix">
                            <p class="">活动名称</p>
                            <p>发布时间</p>
                            <!--<p>浏览次数</p>-->
                            <p>企业邀请</p>
                            <p>邀请未确定数</p>
                            <p>累计可获得赞助金</p>
                            <p>赞助详情</p>
                        </div>
                        <div ng-controller="supportCtrl">
                            <ul class="assoc-cruc-tab">
                                <li class="assoc-cru-list clearfix" ng-repeat="x in names">
                                    <p>{{x.ProjectName}}</p>
                                    <p>{{x.CreateDate|date:'yyyy-MM-dd'}}</p>
                                    <!--<p>3</p>-->
                                    <p>{{x.ContractCount}}</p>
                                    <p>{{x.UnAcceptCount}}</p>
                                    <p>{{x.Amount}}</p>
                                    <p>
                                        <a href="supportDetail.html?id={{x.ProjectID}}" class="assoc-crul-check">点击查看</a>
                                        <!--<a href="javascript:void(0)" class="assoc-crul-delete ml15"></a>
                                        <a href="javascript:void(0)" class="assoc-crul-edit ml15"></a>-->
                                    </p>
                                </li>
                            </ul>
                            <div class="page">
                                <div class="center">
                                    <pager page-count="pageCount" current-page="currentPage" on-page-change="onPageChange()" first-text="首页" next-text="下一页" prev-text="上一页" last-text="尾页"></pager>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </section>
    </div>
    <div id="divFooter"></div>
</body>
</html>

<script type="text/javascript" src="/static/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>
<script type="text/javascript" src="/static/js/angular.min.js"></script>
<script type="text/javascript" src="/static/js/ng-pagination.min.js"></script>
<script>

    $("#divHeader").load("/wuc/header.html");
    $("#divFooter").load("/wuc/footer.html");
    $("#divNavigation").load("/wuc/navigation.html");

    var values = {};
    values.Limit = 10;
    values.Start = 1;
    values.ProjectStatus = "Open";

    common.CreatePagingCtrl({ name: 'supportCtrl', limit: 10, pageChanged: ChangePage });

    function AfterCompleted(ctx) {
        if (ctx == null) {
            common.alertMessage("无数据.");
            return;
        }

        var ele = document.querySelector("[ng-controller=supportCtrl]");

        angular.element(ele).scope().update(ctx);
    }

    common.commonAjax({ type: 'Post', url: '/api/project/ListProjectsByStatus', data: values, sMethod: AfterCompleted });

    function ChangePage($scope) {

        values.Start = $scope.currentPage;

        common.commonAjax({ type: 'Post', url: '/api/project/ListProjectsByStatus', data: values, sMethod: AfterCompleted });
    }

    $("#assoc-cru-title li").on('click', function (e) {
        var self = $(this);
        var index = $(this).index();
        self.siblings().removeClass('active');
        self.addClass('active');
        if (index == 0) {
            values.ProjectStatus = "Open";
            values.Start = 1;
            common.commonAjax({ type: 'Post', url: '/api/project/ListProjectsByStatus', data: values, sMethod: AfterCompleted });
        }
        else {
            values.ProjectStatus = "Closed";
            values.Start = 1;
            common.commonAjax({ type: 'Post', url: '/api/project/ListProjectsByStatus', data: values, sMethod: AfterCompleted });
        }
        //self.parent().next(".assoc-cru-content").find('.assoc-cruc-tab').hide()
        //self.parent().next(".assoc-cru-content").find('.assoc-cruc-tab').eq(index).show()
    });

</script>
